<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

// Removes the WordPress Update prompt in Admin
// Taken from http://wordpress.org/plugins/disable-wordpress-core-update/

add_filter('pre_site_transient_update_core', function () {
	return null;
});

function ai_init () {
	wp_enqueue_style('jquery-ui-lightness', get_stylesheet_directory_uri() . '/assets/css/jquery-ui/css/ui-lightness/jquery-ui-1.8.16.custom.css');

	
	wp_enqueue_script('jquery-ui-accordion', false, array('jquery'));
	wp_enqueue_script('ai_faq.js', get_stylesheet_directory_uri() . '/assets/js/faq.js', array('jquery'));

	wp_enqueue_style('flexslider.css', get_stylesheet_directory_uri() . '/assets/js/library/flexslider/flexslider.css' );

	wp_enqueue_script('flexslider.js', get_stylesheet_directory_uri() . '/assets/js/library/flexslider/jquery.flexslider-min.js', array('jquery'));

	wp_enqueue_script('ai_slider.js', get_stylesheet_directory_uri() . '/assets/js/slider.js', array('jquery'));

	wp_enqueue_style('ai_style.css', get_stylesheet_uri(), array());

}

add_action( 'wp_enqueue_scripts', 'ai_init' );

/**
 * Function enable excerpt in page (page type post). Excerpt is not enable by default for page type post
 */
function ai_page_excerpt_support () {
	add_post_type_support('page', 'excerpt');
}

add_action('init', 'ai_page_excerpt_support');

/**
 * custom function to get about us
 */
function ai_get_about_us () {
	$aArgs = array(
		'post_type' => 'page',
		'pagename' => 'about-us'
	);

	$oPost = new WP_Query($aArgs);

	if ($oPost->have_posts()) {
//		die();
		wp_reset_query();
		return $oPost;
	} else {
		return null;
	}
}

function ai_get_service_for_home () {
	$aArgs = array(
		'post_type' => 'service',
		'posts_per_page' => 2
	);

	$oPost = new WP_Query($aArgs);

	if ($oPost->have_posts()) {
		wp_reset_query();
		return $oPost;
	} else {
		return null;
	}
}

function ai_get_single_page ($sPageTitle) {
	$aArgs = array(
		'post_type' => 'page',
		'pagename' => $sPageTitle
	);

	$oPost = new WP_Query($aArgs);

	if ($oPost->have_posts()) {
//		die();
		wp_reset_query();
		return $oPost;
	} else {
		return null;
	}
}

?>